{include file="header/index" /}
		<!--导航结束-->
		<div class="container whitebg mb50">
			<div class="topnav clearfix">
				<div class="title fl">
					<h3>推荐设备详情</h3>
				</div>
				<a class="backbtnwrap fr"  href="{:url('customerinfo/details')}?user_id={$cid}">
					<button type="button" class="btn backbtn">返回</button>
				</a>
			</div>
			<form class="form-inline mb20 mt20" action="" method="post">
				<div class="form-group">
					<img src="__IMG__/sanLine.png"><a href="{:url('Customerinfo/devicedetails',['cid'=>$cid,'type'=>0])}" ><span class=" ml10 mr10 cursor {if condition="$type==0"} col-127{/if}" >未使用</span></a>|<a href="{:url('Customerinfo/devicedetails',['cid'=>$cid,'type'=>1])}" ><span class="ml10 mr10 cursor {if condition="$type==1"} col-127{/if}" >已使用</span></a>
				</div>
				<p class="fr equipmentTotal">未使用有效设备数总计:<span class="redcolor">{$count}</span></p>
			</form>
			<form id="yh">
			<table class="table table-bordered">
				<tr>
					{eq name="$type" value="0"}
						<th><input type="checkbox" onclick="selectall(this,'box')" /></th>
					{/eq}
					<th>推荐会员名</th>
					<th>会员电话</th>
					<th>合同编号</th>
					<th>设备号</th>
					<th>优惠状态</th>
					<th>使用时间</th>
					<th>操作人</th>
				</tr>
				{foreach $list as $vo}
					{foreach $vo as $vl}
						<tr>{eq name="$type" value="0"}
							<td><input type="checkbox" name="box" value="{$vl.id}"/></td>
							{/eq}
							<td><input type="hidden" name="username[]" value="{$vl.username}">{$vl.username}</td>
							<td>{$vl.telphone}</td>
							<td><input type="hidden" name="contract_no[]" value="{$vl.contract_no}">{$vl.contract_no}</td>
							<td><input type="hidden" name="equipments_number[]" value="{$vl.equipments_number}">{$vl.equipments_number}</td>
							<td class="col-127">
								{eq name="$vl.is_Discount" value="0"}
								未使用
								{else/}
								已使用
								{/eq}
							</td>
							<td>
								{eq name="$vl.is_Discount" value="1"}
									{$vl.Discount_time|date='Y-m-d',###}
								{/eq}
							</td>
							<td class="bluecolor">
								{eq name="$vl.is_Discount" value="1"}
								{$vl.Discount_people}
								{/eq}
							</td>
						</tr>
					{/foreach}
				{/foreach}
			</table>
			</form>
			<?php if(!empty($isAdmin)&&$isAdmin==1){?>
			{eq name="$type" value="0"}
			<button type="button" class="fr userDiscount" onclick="myModalLabel({$cid})">使用优惠</button>
			{/eq}
			<?php }?>
			<div class="clearfix"></div>
			<div class="operation_record mb30" id="operation_record">
				<p class="title">操作记录</p>
				<div class="record_list">
					<?php if(!empty($userR)){?>
					{volist name="userR" id="k"}
					<p>管理员{$k.admin} 操作{$k.username}用户 使用优惠成功<time class="fr a1color">{$k.usedtime|date='Y-m-d H:i:s',###}</time></p>
					{/volist}
					<?php }if(empty($userR)){?>
					<p>暂无操作记录</p>
					<?php }?>
				</div>
			</div>
			
			<div class="clearfix"></div>
			<div class="operation_record mb30" id="operation_record">
				<p class="title">备注(优惠使用情况)</p>
				<div class="record_list">

					<?php if(!empty($userR)){?>
					{volist name="userR" id="k"}
					<div class="relative">
						<p onmouseover="modelhover(this)" onmouseout="modelclose(this)"><span>{$k.username}用户 使用推荐会员{$k.name} {$k.log}</span><time class="fr a1color">{$k.usedtime|date='Y-m-d H:i:s',###}</time></p>
						<p class="hides hovermodel">{$k.username}用户 使用推荐会员{$k.name} {$k.log}</p>
					</div>
					{/volist}
					<?php }if(empty($userR)){?>
					<p>暂无备注(优惠使用情况)</p>
					<?php }?>
				</div>
			</div>			
		</div>
	</body>

</html>
<script type="text/javascript">
	function  modelhover(obj) {
	    if($('.record_list p span').width()<=400){
	        $(obj).next().show();
		}
    }

    function modelclose(obj) {
        $(obj).next().hide();
    }

	function myModalLabel(i){
	    var name= ''
			$('input:checkbox[name=box]:checked').each(function(i){
            if(0==i){
                name = $(this).val();
            }else{
                name += (","+$(this).val());
            }
        });
		var html='<div>';
			html+='<div class="modal-body" style="padding: 15px 20px;">';
			html+='<div id="wordCount" class="useDiscountr">';
			html+='<textarea id="log" class="form-control" rows="8" placeholder="输入某合同的优惠具体时段（例：优惠3月-6月的费用）"></textarea>';
			html+='<span class="wordwrap">500字以内</span>';								
			html+='</div>';
			html+='<p class="userDiscountP">是否确认使用优惠</p>';
			html+='</div>';
			html+='<div class="modal-footer" style="text-align: center;">';
			html+='<button type="button" id="btnR" onclick="recommend(\''+name+'\','+i+')" class="btn btn-primary mr20">确认</button>';
			html+='<button type="button" class="btn btn-default" onclick="layuihide()"  style="margin-left: 20px;">取消</button>';
			html+='</div>';
			html+='</div>';
		top.layer.open({
		  type: 1,
		  title: '添加备注',
		  skin: 'layui-layer-demo', //样式类名
		  closeBtn: 0, //不显示关闭按钮
		  anim: 2,
		  area: ['600px', '420px'], //宽高
		  shadeClose: true, //开启遮罩关闭
		  content:html
		});
	}

	
	
	function layuihide(){
		$(".layui-layer-shade").hide();
		$(".layui-layer").hide()
	}

	
	//复选框选中
	function selectall(obj, name) {
		if(obj.checked) {
			$("input[type=checkbox][name='" + name + "']").prop("checked", true);
		} else {
			$("input[type=checkbox][name='" + name + "']").prop("checked", false);
		}
	}

	
	
	function equipment(obj){
		$(obj).addClass("col-127");
		$(obj).siblings().removeClass("col-127")
	}
</script>